package com.jack.spider;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

import com.jack.entity.Student;
import com.jack.service.StudentService;

@Repository
public class QiuBaiPipeLine implements Pipeline {
	@Resource
	private StudentService	studentService;

	@Override
	public void process(ResultItems resultItems, Task task) {
		List<String> ht_l = resultItems.get("list");
		for (String string : ht_l) {
			Student student=new Student();
			student.setName(string);
			System.err.println(student.getName());
			studentService.save(student);
		}
	}

}
